package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"os"
)

type Address struct {
	Type    string
	City    string
	Country string
}

type VCard struct {
	FirstName string
	LastName  string
	Addresses []*Address
	Remark    string
}

func main() {
	vc := &VCard{}
	jsonFile, _ := os.Open("vcard.json")
	jsonStr, _ := ioutil.ReadAll(jsonFile)
	err := json.Unmarshal(jsonStr, vc)
	if err != nil {
		log.Println("Error in encoding json")
	}
	fmt.Printf(" %v  ", vc)
	for _, v := range vc.Addresses {
		fmt.Printf(" %v ", v)
	}
}
